﻿using System;
using System.Collections.Generic;

namespace ASP.NetAjaxApplication.Models
{
    public  class OrderRepository :IRepository<OrderModel>
    {
        private List<OrderModel> _listOrder;

        public OrderModel Get(Guid? id)
        {
            var model = new OrderModel
                            {
                                Client = new ClientModel(),
                                Address = new ShipAddressModel(),
                                RequestedDate = DateTime.Now.Date.AddDays(-10),
                                SubmittedDate = DateTime.Now.Date.AddDays(-4),
                                Header = DummyData.CreateOrderHeader(),
                                LineItems = Repository.LineItems.GetAll()
                            };
            return model;
        }


        #region Implementation of IRepository<OrderModel>

        public IEnumerable<OrderModel> GetAll()
        {
            throw new NotImplementedException();
        }

        public OrderModel Insert(OrderModel value)
        {
            if(_listOrder==null)
            {
               _listOrder = new List<OrderModel>();
            }

            _listOrder.Add(value);

            return value;
        }

        public bool Update(OrderModel value)
        {
            throw new NotImplementedException();
        }

        public bool Delete(OrderModel value)
        {
            throw new NotImplementedException();
        }

        #endregion
    }
}